<template>
	<view>
		<u-swiper v-if="list1.length>0" @click="click" :list="list1" height="220" radius="0" :indicator="true" indicatorMode="dot"></u-swiper>
		<view class="boxes">
			<view class="title">电梯信息</view>
			<view>使用单位：{{msg.dianti.sydw}}</view>
			<view>项目名称：{{msg.dianti.xmmc}}</view>
			<view>电梯类型：{{msg.dttype}}</view>
			<view class="uniFlex">
				电梯位置：
				<text>{{msg.dianti.address}}</text>
				<img src="@/static/mains/m7.png" alt="" />
			</view>
			
			<view class="title">保养信息</view>
			<view>工单编号：{{msg.id}}</view>
			<view>维保人员：{{msg.userlist}}</view>
			<view>维保类型：{{msg.typestr}}</view>
			<view>维保状态：{{msg.content}}</view>
			<view>开始时间：{{msg.start_time}}</view>
			<view>结束时间：{{msg.end_time}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list1: [
					// 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					// 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				],
				msg:{
					dianti:{
						sydw:'',
						xmmc:'',
						address:'',
					},
					dttype:'',
					id:'',
					userlist:'',
					typestr:'',
					content:'',
					start_time:'',
					end_time:'',
				}
			}
		},
		async onLoad(options) {
			// console.log(options.id)
			let res = await this.$api.wbinfo({id:options.id});
			if (res.code == 1) {
				if(res.data.images.length>0){
					this.list1 = res.data.images;
				}
				this.msg = res.data;
			}
		},
		methods: {
			click(index){
				uni.previewImage({
					current: index, //预览图片的下标
					urls: this.list1 //预览图片的地址，必须要数组形式，如果不是数组形式就转换成数组形式就可以
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.boxes{
		margin: 20rpx 15rpx;
		padding:20rpx 30rpx;
		border-radius: 20rpx;
		background: #fff;
		font-size: 30rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #000000;
		
		.title{
			color: #1d87cf;
			margin: 20rpx 0;
		}
		view {
			margin: 10rpx 0;
			white-space: nowrap;
		}
		text {
			color: #1d87cf;
			white-space: normal;
		}
		img {
			width: 31rpx;
			height: 31rpx;
			flex-shrink: 0;
			margin-left: 10rpx;
		}
	}
</style>
